package com.onerway.api;

import com.onerway.entity.OnerWayResponse;
import com.onerway.entity.charge.ChargeBack;
import com.onerway.entity.charge.ChargebackInfo;
import com.onerway.entity.payment.PaymentRes;
import com.onerway.entity.payment.TxnOrder;
import com.onerway.entity.payment.UpdateOrder;
import com.onerway.entity.refund.RefundReq;
import com.onerway.entity.settle.SettlementFile;
import com.onerway.entity.token.BindTokenInfo;
import com.onerway.entity.token.TokenReq;
import com.onerway.entity.OnerWayPage;
import com.onerway.entity.transaction.QueryTransaction;
import com.onerway.entity.transaction.TransactionRecord;

import java.io.IOException;

public interface OnerWayClient {


    /**
     * 下单支付单
     *
     * @param txnOrder
     * @return
     * @throws IOException
     */
    OnerWayResponse<PaymentRes> cashierPayment(TxnOrder txnOrder) throws IOException;

    /**
     * 下单支付单
     *
     * @param txnOrder
     * @return
     * @throws IOException
     */
    OnerWayResponse<PaymentRes> payment(TxnOrder txnOrder) throws IOException;


    /**
     * 两方支付单
     *
     * @param txnOrder
     * @return
     * @throws IOException
     */
    OnerWayResponse<PaymentRes> biPayment(TxnOrder txnOrder) throws IOException;


    /**
     * 更新支付单
     *
     * @param updateOrder
     * @return
     * @throws IOException
     */
    OnerWayResponse<PaymentRes> updatePayment(UpdateOrder updateOrder) throws IOException;

    /**
     * 查询交易记录
     *
     * @param queryTransaction
     * @return
     * @throws IOException
     */
    OnerWayResponse<OnerWayPage<TransactionRecord>> txnList(QueryTransaction queryTransaction) throws IOException;

    /**
     * 拒付订单查询
     *
     * @param chargeBack
     * @return
     * @throws IOException
     */
    OnerWayResponse<OnerWayPage<ChargebackInfo>> chargebackList(ChargeBack chargeBack) throws IOException;


    /**
     * 申请退款
     *
     * @param refundReq
     * @return
     */
    OnerWayResponse<String> onlineRefund(RefundReq refundReq) throws IOException;


    /**
     * 用于TOKEN支付。商家可以通过这个接口，展示顾客绑过的卡。
     *
     * @param tokenReq
     * @return
     * @throws IOException
     */
    OnerWayResponse<BindTokenInfo> tokenList(TokenReq tokenReq) throws IOException;

    /**
     * 结算文件下载
     *
     * @param settlementFile
     * @return
     */
    byte[] settlementFileDownload(SettlementFile settlementFile) throws IOException;
}
